var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
    res.render('index', {
        title: '日志分析系统'
    });
});

//匹配dashboard的路径
router.get('/:filename', function(req, res, next) {
    var filename = req.param('filename');
    var render = "";
    var title = "";
    switch(filename){
        case "blank.html":
            render = "blank";
            break;
        case "buttons.html":
            render = "buttons";
            break;
        case "flot.html":
            render = "flot";
            break;
        case "forms.html":
            render = "forms";
            break;
        case "grid.html":
            render = "grid";
            break;
        case "icons.html":
            render = "icons";
            break;
        case "index.html":
            render = "index";
            title = "首页"
            break;
        case "login.html":
            render = "login";
            break;
        case "morris.html":
            render = "morris";
            break;
        case "notifications.html":
            render = "notifications";
            break;
        case "panels-wells.html":
            render = "panels-wells";
            break;
        case "tables.html":
            render = "tables";
            break;
        case "typography.html":
            render = "typography";
            break;
        default:
        //没有匹配上当前路由，则进入下一个路由
            next();
            return
    }
    res.render(render, {
        title: title
    });
});


module.exports = router;